<template>
	<view>
		<picker @change="bindPickerChange" :disabled="disabled" range-key="label" :range="range">
			<view class="uni-input">
				<text v-if="inputName">{{inputName}}</text>
				<text v-else class="placeholder">请选择</text>
				<uni-icons type="right" color="#999" size="16"></uni-icons>
			</view>
		</picker>
	</view>
</template>

<script>
	// import {
	// 	dictDataType,
	// } from "@/api/system.js";
	export default {
		model: {
			event: "inputFun",
		},
		props: ['inputName', "Radio", "disabled", 'isme', 'range', "rangeKey"],
		data() {
			return {
				act: ""
			};
		},
		watch: {
			Radio(newVal) {}
		},
		mounted() {
			if (this.Radio) {
				// this.dictDataType2(this.Radio,this.isme)
			}
		},
		methods: {
			// dictDataType2(e,is) {
			// 	dictDataType({
			// 		type: e
			// 	}).then(res => {
			// 		this.range = res.data
			// 		if(this.isme){
			// 			this.range.shift()
			// 		}
			// 	})
			// },
			getName(e) {
				let item = this.range.find(i => i.id == e);
				if (item.label) {
					return item.label || 0;
				}
			},
			bindPickerChange(e) {
				this.act = e.detail.value
				this.$nextTick(() => {
					this.$emit("inputFun", this.range[e.detail.value].label)
					console.log(this.range[e.detail.value].label)
				})
			},
		}
	}
</script>

<style lang="less">
	.uni-input {
		display: flex;
		justify-content: right;
		align-items: center;
		height: 100%;
		height: 70rpx;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;

		.placeholder {
			color: #999;
		}
	}

	.uni-icons {
		position: relative;
		top: 1rpx;
	}

	/deep/.uni-forms-item__content {
		&>view {
			height: 100%;
		}

		align-items: center;
	}
</style>